package com.itheima.reggie.mapper;

import com.github.pagehelper.PageInfo;
import com.itheima.reggie.entity.Employee;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface EmployeeMapper {
    /**
     * 用户登录
     * @param employee
     * @return
     */
    @Select("SELECT *FROM employee WHERE username=#{username};")
    Employee login(Employee employee);
    /**
     * 保存用户
     */
    @Insert("INSERT INTO employee VALUES(NULL,#{name},#{username},#{password},#{phone},#{sex},#{idNumber},1,#{createTime},#{updateTime},#{createUser},#{updateUser});")
    void   save(Employee employee);
/**
 *     添加员工
 */

  List<Employee> findByName(@Param("name") String name);
    /**
     *  员工列表更新
     */
    void update(Employee employee);

    /**
     * 根据id查找员工
     * @param id
     * @return
     */
    @Select("SELECT *FROM employee WHERE id=#{id};")
    Employee finById(long id);
}
